/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface PmMaterial extends BasicModel<PmMaterial> {
  createtime?: string; // 创建时间
  name?: string; // 工程名称
  pcode?: string; // 工程编码
  sno?: string; // sno
  fdno?: string; // 设计变更编码
  mcode?: string; // 物料编码
  mname?: string; // 物料名称
  mstd?: string; // 规格型号
  num?: number; // 数量
  unit?: string; // 单位
  istart?: number; // 标识标识
  fpDataChildList?: any[]; // 分配明细
}

export const pmMaterialList = (params?: PmMaterial | any) =>
  defHttp.get<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/list', params });

export const pmMaterialListData = (params?: PmMaterial | any) =>
  defHttp.post<Page<PmMaterial>>({ url: adminPath + '/material/bom/pmMaterial/listData', params });

export const pmMaterialForm = (params?: PmMaterial | any) =>
  defHttp.get<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/form', params });

export const pmMaterialSave = (params?: any, data?: PmMaterial | any) =>
  defHttp.postJson<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/save', params, data });

export const pmMaterialDelete = (params?: PmMaterial | any) =>
  defHttp.get<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/delete', params });

export const pmMaterialSetMain = (params?: PmMaterial | any) =>
  defHttp.get<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/setMain', params });

export const pmMaterialCancelMain = (params?: PmMaterial | any) =>
  defHttp.get<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/cancelMain', params });

export const pmMateriallAllot = (params?: PmMaterial, data?: PmMaterial | any) =>
  defHttp.postJson<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/allot', params, data });

export const pmMateriallConfirm = (params?: PmMaterial, data?: PmMaterial | any) =>
  defHttp.postJson<PmMaterial>({
    url: adminPath + '/material/bom/pmMaterial/confirm',
    params,
    data,
  });

export const pmMateriallUpdateQty = (params?: PmMaterial, data?: PmMaterial | any) =>
  defHttp.postJson<PmMaterial>({
    url: adminPath + '/material/bom/pmMaterial/updateQty',
    params,
    data,
  });


export const pmMaterialRefresh = (params?: PmMaterial | any) =>
  defHttp.post<PmMaterial>({ url: adminPath + '/material/bom/pmMaterial/refresh', params });


export const pmMaterialListPuData = (params?: PmMaterial | any) =>
  defHttp.post<Page<PmMaterial>>({ url: adminPath + '/material/bom/pmMaterial/listPuData', params });

export const pmMaterialListStData = (params?: PmMaterial | any) =>
  defHttp.post<Page<PmMaterial>>({ url: adminPath + '/material/bom/pmMaterial/listStData', params });
